

#ifndef _UPWIND_CODI_H_
#define _UPWIND_CODI_H_

#include "Tuna.hpp"
#include "Equations/ScalarEquation.hpp"

namespace Tuna {

  template <typename T, int Dim> class Upwind_CoDi;

  template <typename T>
  struct Typeinfo <Upwind_CoDi<T, 1> > {
    typedef T prec_t;
    enum { Dim = 1 };
  };

  template <typename T>
  struct Typeinfo <Upwind_CoDi<T, 2> > {
    typedef T prec_t;
    enum { Dim = 2 };
  };

  template <typename T>
  struct Typeinfo <Upwind_CoDi<T, 3> > {
    typedef T prec_t;
    enum { Dim = 3 };
  };
  
/*!
 ***************************************************************************
 * Adaptor for central differences for energy equation.
 ***************************************************************************
 *  \author  Luis M. de la Cruz [ Mon Mar 17 19:55:58 GMT 2008 ]
 ***************************************************************************
 */
template<typename Tprec, int Dim>
class Upwind_CoDi : public ScalarEquation< Upwind_CoDi< Tprec, Dim > >
{
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::aE;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::aW;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::aN;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::aS;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::aF;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::aB;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::aP;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::sp;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::dx;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::dy;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::dz;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::bi;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::ei;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::bj;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::ej;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::bk;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::ek;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::dt;    
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::applyBoundaryConditions1D;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::applyBoundaryConditions2D;
    using GeneralEquation<ScalarEquation<Upwind_CoDi<Tprec, Dim > > >::applyBoundaryConditions3D;
    
    using ScalarEquation<Upwind_CoDi<Tprec, Dim > >::Gamma;
    using ScalarEquation<Upwind_CoDi<Tprec, Dim > >::phi_0;
    using ScalarEquation<Upwind_CoDi<Tprec, Dim > >::u;
    using ScalarEquation<Upwind_CoDi<Tprec, Dim > >::v;
    using ScalarEquation<Upwind_CoDi<Tprec, Dim > >::w;
    
public:
    typedef Tprec prec_t;
    typedef typename TunaArray<prec_t, Dim>::huge ScalarField;

    Upwind_CoDi() : ScalarEquation<Upwind_CoDi<prec_t, Dim> >() { }
    ~Upwind_CoDi() { }; 

  /*!
   * FVM coefficients calculations in 1D.
   */
  inline bool calcCoefficients1D(); 

  /*!
   * FVM coefficients calculations in 2D.
   */
  inline bool calcCoefficients2D();

  /*!
   * FVM coefficients calculations in 3D.
   */
  inline bool calcCoefficients3D();

    inline void printInfo() { std::cout << " Upwind_CoDi "; }
};

} // Tuna namespace

#include "../../src/Schemes/Upwind_CoDi.cpp"

#endif //_UPWIND_CODI_H_

















